package han.gui;

import java.util.List;

import han.project.speakingcookbook.R;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class RecipeListAdapter extends ArrayAdapter<String> {
	private final Context context;
	private final String[] values;

	public RecipeListAdapter(Context context, String[] value) {
		super(context, R.layout.rows, value);
		this.context = context;
		this.values = value;
	}

	@Override
	public View getView(int posi, View convertView, ViewGroup parent) {
		LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		View rows = inflater.inflate(R.layout.rows, parent, false);
		TextView textView = (TextView) rows.findViewById(R.id.recipe);
		ImageView image = (ImageView) rows.findViewById(R.id.list_image);
		textView.setText(values[posi]);
		String s = values[posi];
		if (s.startsWith("Spagehtti")) {
			image.setImageResource(R.drawable.ic_launcher);
		} else {
			;
		}
		return rows;
		
	}

}
